<?php

namespace App\Models\Open;

use Dcat\Admin\Models\Administrator;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;

class ApiInfo extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'api_infos';

    public function adminUser(): BelongsTo
    {
        return $this->belongsTo(Administrator::class );
    }

    public function platform(): BelongsTo
    {
        return $this->belongsTo(Platform::class );
    }

    public function appType(): BelongsTo
    {
        return $this->belongsTo(AppType::class );
    }

    public function microApps(): BelongsToMany
    {
        return $this->belongsToMany(MicroApp::class, 'micro_app_api_info');
    }
}
